﻿using J.Model;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace J.ProductRepository
{
    public class Mydbcontext
    {
        private readonly ISqlSugarClient db;
        public Mydbcontext(ISqlSugarClient db)
        {
            this.db = db;
        }
        public void CreateDataBase()
        {
            db.DbMaintenance.CreateDatabase();
            // 信息类型表为预留信息表的子表
            db.CodeFirst.InitTables(typeof(INFORMATIONTYPETABLE));
            //预留信息表
            db.CodeFirst.InitTables(typeof(RESERVATIONINFORMATIONTABLE));
            //商品标签表
            db.CodeFirst.InitTables(typeof(ProductLabel));
            //分类管理表
            db.CodeFirst.InitTables(typeof(ClassifiedManagement));
            //商品表
            db.CodeFirst.InitTables(typeof(Product));
            //聚合商品表
            db.CodeFirst.InitTables(typeof(AggregateCommodity));
            //商户设置表
            db.CodeFirst.InitTables(typeof(CommercialOwner));
            //价格库存管理
            db.CodeFirst.InitTables(typeof(PriceInventoryControl));
            //发布预约
            db.CodeFirst.InitTables(typeof(ReleaseAppointment));
        }
    }
}
